#include<bits/stdc++.h>
using namespace std;

int n;
vector<long long> vec;
vector<int> num;
long long x;
int main(){
	cin>>n;
	for(int i=1;i<=(int)pow(2,n);i++){
		cin>>x;
		vec.push_back(x);
		num.push_back(i);
	}
	vector<long long> vec2;
	vector<int> num2;
	while(vec.size()>2){
		vec2.clear();
		num2.clear();
		for(int i=0;i<vec.size();i+=2){
			if(vec[i]>vec[i+1]){
				vec2.push_back(vec[i]);
				num2.push_back(num[i]);
			}
			else{
				vec2.push_back(vec[i+1]);
				num2.push_back(num[i+1]);				
			}
		}
		vec=vec2;
		num=num2;
	}
	if(vec[0]>vec[1]) cout<<num[1];
	else cout<<num[0];
	return 0;
}
